package option;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class Find implements Ioperate{
    @Override
    public void work(BookList bookList) {
        System.out.println("输入你要查找的书名：");
        Scanner scan = new Scanner(System.in);
        String bookName = scan.nextLine();

        int size = bookList.getCurSize();
        for (int i = 0; i < size; i++) {
            Book book = bookList.getBooks(i);
            if(book.getName().equals(bookName)){
                System.out.println(book);
                return;
            }
        }

        System.out.println("查无此书......");
    }
}
